$(document).ready(function() {
    $('.option-btn').click(function () {

        const model = $(this).attr('model');
        switch (model){
            case 'store':
                createTab("https://store.weixin.qq.com/");
                break;
            case 'pdd':
                createTab("https://mobile.yangkeduo.com");
                break;
            case 'pdduser':
                createTab("https://mobile.yangkeduo.com/personal.html")
        }
    });

    chrome.runtime.sendMessage({greeting: 'login'}, (response) => {
        if (response.code == 200) {
            $('#nikename').html(response.data.nikename);
        }
    });
});
//打开新tab页面
function createTab(url) {
    chrome.tabs.create({
        url: url,
        selected: true
    })
}